<%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2019/1/9
  Time: 21:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path= request.getContextPath();
    String  basePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>拍卖场</title>
    <link rel="stylesheet" href="<%=basePath%>/statics/backcss/css/salldetail.css" type="text/css">
    <script type="text/javascript" src="<%=basePath%>/plugins/jquery.min.js"></script>
</head>
<body >
<div class="nav_area">
    <div class="container">
        <div class="navbar">
            <div class="navbar-inner">
                <div class="container">
                    <div class="nav-collapse">
                        <ul class="nav">
                            <li class="nav_index"><a href="<%=basePath%>/canvas/listdo">首页</a></li>
                            <li class="nav_bidding"><a href="#">开拍标的</a></li>
                            <li class="nav_announcement"><a href="#">拍卖公告</a></li>
                            <li class="nav_information"><a href="<%=basePath%>/sall/salls">拍卖资讯</a></li>
                            <li class="nav_case"><a href="#">成交案例</a></li>
                            <li class="nav_source"><a href="#">资产源提报</a></li>
                            <li class="nav_mine"><a href="<%=basePath%>/sall/index">我的拍卖</a></li>
                            <li class="nav_about"><a href="#">关于我们</a></li>
                        </ul>
                        <div class="navr">
                            <ul>
                                <li><a href="../user/login">登录</a></li>
                                <li><a href="#">注册</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="headLogo_box" class="container">
    <div class="detail_head container bd_d8" style="height: 430px;">
        <!-- 左侧 -->
        <div class="detail_headLeft">
            <!-- 详情标题 -->
            <div class="detailTitle_box">
                <h4 class="detailTitle">${applicationScope.canvas.name}</h4><!--油画名-->
            </div>
            <!-- 放大镜展示区 -->
            <div class="imgZoom_Area">
                <img id="imgZoom" src="../statics/image/${applicationScope.canvas.img}" >
            </div>
        </div>
        <!-- 中部竞价 -->
        <div class="detail_headMiddle">
            <!-- 分享 -->
            <div class="share_area">
                <!-- 结束后如果有下一标的跳转 -->
                结束时间：<span id="ifJump"><fmt:formatDate value="${applicationScope.sall.endtime}" pattern="yyyy/MM/dd hh:mm:ss "/></span>
            </div>
            <!-- 实时价格 和 剩余时间 -->
            <div class="realTime_area">
                <!-- 左侧实时价格 时间 -->
                <ul class="realTime_box">
                    <li class="realTime_priceBox">
                        <span class="realTime_txt">当前价格:</span>
                        <span class="realTime_price" id="price">${applicationScope.sall.maxprice}元</span>
                    </li>
                    <li class="realTime_timeBox">
                        <span class="statusBox">
                            距结束
                        </span>:
                        <span class="realTime_time" id="leaveTime"></span>
                    </li>
                </ul>
                <!-- 右侧icon -->
                <div></div>
            </div>
            <!-- 实时出价 -->
            <div class="AuctionBid_area">
                <span class="AuctionBid_label">
                    您的出价
                </span>
                <!-- 加价区域 -->
                <div class="AuctionBid_operation" id="AuctionBid_operation" corporecode="BD190103100003" auctioncode="PM190103100002" categoryname="物资设备拍卖">
                    <div class="AuctionBid_content">
                        <input type="text" class="AuctionBid_input" id="maxprice" value="">
                        <input type="submit" id="submit"  class="sure_add" value="提交">
                    </div>
                </div>
            </div>
            <!-- 拍卖详情 -->
            <div class="AuctionInfo_area">
                <ul class="info_box ">
                    <li class="startPrice_box">
                        起拍价:
                        <span class="startPrice">1000元</span>
                        <span class="startUnit">/副</span>
                    </li>


                    <li class="aucReserved_box">
                        保留价:
                        <span class="aucReserved">有</span>
                    </li>

                    <li class="Amplitude_box">
                        <span class="p1_span" style="margin-left:0;">
                          加价幅度
                        </span>
                        :
                        <span class="Amplitude">10</span>
                        元
                    </li>

                </ul>
                <ul class="info_box boxMiddle">
                    <li class="aucType_box">
                        类型:
                        <span class="aucType">竞价</span>
                    </li>
                    <li class="limitedTime_box">
                        限时竞价:
                        <span class="limitedTime">若干</span>
                        小时
                    </li>
                    <li class="free_box">
                        <span class="freeTxt">
                            自由竞价:
                        </span>
                        <span class="free">任意</span>
                        小时
                    </li>
                </ul>
                <ul class="info_box ">
                    <li class="margin_box">
                        保证金:
                        <span class="margin">500</span>
                        元
                    </li>

                    <li class="evaluation_box">
                        评估价:
                        <span class="evaluation">无</span>
                    </li>

                    <li class="aucPriority_box">
                        优先购买权人:
                        <span class="aucPriority">无</span>
                    </li>

                </ul>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        $("#submit").click(function () {
            var obj=new Object()
            obj.maxprice=$("#maxprice").val()
            console.log(obj.maxprice);
            $.ajax({
                url:'joinsall',
                type:'post',
                datatype:'json',
                contentType:'application/json;charset=utf-8',
                data:JSON.stringify(obj),
                success:function(data){
                    var jsonobj=eval(eval("("+data+")"))
                    alert(jsonobj.message)
                    if (jsonobj.code==1){
                        $("#price").text(obj.maxprice);
                    $("#maxprice").val("")
                    window.location.reload();
                    window.close();
                    }else {
                        window.location.href="http://localhost:8088/web/user/login";
                    }
                },
                error:function (data) {
                    var jsonobj=eval(eval("("+data+")"))
                    alert(jsonobj.message)
                }
            });
        })
    })
    //
    // var oSpan = document.getElementsByTagName('span')[0];
    var oSpan = document.getElementById("leaveTime");
    function tow(n) {
        return n >= 0 && n < 10 ? '0' + n : '' + n;
    }
    function getDate() {
        var datastr=document.getElementById("ifJump").innerText
        var oDate = new Date();//获取现在日期对象
        var oldTime = oDate.getTime();//现在距离1970年的毫秒数
        var newDate = new Date(datastr);//获取指定日期对象
        var newTime = newDate.getTime();//2018年距离1970年的毫秒数
        if (newTime<oldTime)
            newTime=oldTime;
        var second = Math.floor((newTime - oldTime) / 1000);//未来时间距离现在的秒数
        var day = Math.floor(second / 86400);//整数部分代表的是天；一天有24*60*60=86400秒 ；
        second = second % 86400;//余数代表剩下的秒数；
        var hour = Math.floor(second / 3600);//整数部分代表小时；
        second %= 3600; //余数代表 剩下的秒数；
        var minute = Math.floor(second / 60);
        second %= 60;
        var str ='<span class="time">'+tow(day)+'</span>'+'天'
          + '<span class="time">'+tow(hour)+'</span>'+'小时'
            + '<span class="time">'+ tow(minute)+'</span>'+'分钟'
            + '<span class="time">'+tow(second)+'</span>'+'秒';
        oSpan.innerHTML = str;
    }
    getDate();
    setInterval(getDate, 1000);
</script>
</body>
</html>
